import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        num: 10,
        arr:[20,30,40,50,60]
    },
    mutations: {
        Incremental(state,payload){
            state.num += payload
        },
        jianfa(state,payload){
            state.num -= payload
        }
    },
    actions: {
        Decreasing(context,payload){
            setTimeout(()=>{
                context.commit('jianfa',payload);
            },2000)
        }
    },
    getters:{
        finName(state,getter){
            return state.arr.filter((item)=>item >30)
        }
    },
    modules: {}
})
